package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	Title string  `gorm:"type:varchar(30);not null"`
	Price float64 `gorm:"type:decimal(10,2);not null"`
	Stock int64   `gorm:"type:int(11);not null"`
}

func (g *Goods) GoodsAdd(db *gorm.DB) error {
	return db.Debug().Create(g).Error
}

func (g *Goods) GoodsList(db *gorm.DB) error {
	return db.Debug().Find(g).Error
}
